package com.augurit.gzcgwsp.ywcmn.convert;

import java.util.ArrayList;
import java.util.List;
 
import org.dozer.DozerBeanMapper;

import com.augurit.gzcgwsp.ywcmn.entity.YwComSjtzsSccl;
import com.augurit.gzcgwsp.ywcmn.web.form.YwComSjtzsScclForm;

public class YwComSjtzsScclConvertor {
	public static YwComSjtzsScclForm convertVoToForm(YwComSjtzsSccl entity) {
		if (entity == null) return null;
		
		return new DozerBeanMapper().map(entity, YwComSjtzsScclForm.class);
	}
	
	public static void convertFormToVo(YwComSjtzsScclForm form, YwComSjtzsSccl entity) {
		if (form == null) return;
		if (entity == null) entity = new YwComSjtzsSccl();
		
		new DozerBeanMapper().map(form, entity);
	}
	
	public static List<YwComSjtzsScclForm> convertVoListToFormList(List<YwComSjtzsSccl> ywComSjcllistList) {
        List<YwComSjtzsScclForm> ywComSjcllistFormList = new ArrayList<YwComSjtzsScclForm>();
		if(ywComSjcllistList != null && ywComSjcllistList.size() > 0) {
			for(int i=0; i<ywComSjcllistList.size(); i++) {
				ywComSjcllistFormList.add(convertVoToForm(ywComSjcllistList.get(i)));
			}
		}
		return ywComSjcllistFormList;
	}
	
	public static List<YwComSjtzsSccl> convertFormListToVoList(List<YwComSjtzsScclForm> ywComSjcllistFormList) {
		if(ywComSjcllistFormList != null && ywComSjcllistFormList.size() > 0) {
			List<YwComSjtzsSccl> ywComSjcllistList = new ArrayList<YwComSjtzsSccl>();
			for(int i=0; i<ywComSjcllistFormList.size(); i++) {
				YwComSjtzsSccl ywComSjcllist = new YwComSjtzsSccl();
				convertFormToVo(ywComSjcllistFormList.get(i), ywComSjcllist);
				ywComSjcllistList.add(ywComSjcllist);
			}
			return ywComSjcllistList;
		}
		return null;
	}
}